package zhttp

import (
    "net/http"

    "github.com/mitchellh/mapstructure"
)

// ParamsAnalysis 参数解析
// Get Post 参数放入map
func ParamsAnalysis(r *http.Request, s interface{}) {
    _ = r.ParseForm()

    params := make(map[string]interface{})
    for name := range r.Form {
        if formValue := r.Form.Get(name); len(formValue) > 0 {
            params[name] = formValue
        }
    }
    _ = mapstructure.WeakDecode(params, s)
}
